home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93a.txt
/
000019_icon-group-sender _Fri Jan 15 13:22:44 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-04-21
|
1KB
Received: by cheltenham.cs.arizona.edu; Fri, 15 Jan 1993 20:15:40 MST
Date: Fri, 15 Jan 93 13:22:44 PST
From: alex@laguna.Metaphor.COM (Bob Alexander)
Message-Id: <9301152122.AA04938@laguna.Metaphor.COM>
To: icon-group@cs.arizona.edu
Subject: Re: Pattern matching in Icon?
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Wow, this seems to be a difficult concept to communicate! However,
considering your last communication, I think my code fragment does what
you want, in current Icon, without muddying things up very much. Let
me re-state it with some clarifying additions:
record syntax_tree(operator, arguments)
...
case type(s) || "::" || s[1] of { # create a key with s's data type
# ("syntax_tree") and the operator
"syntax_tree::let": { # execute this code if the "type"
# is "syntax_tree" and the operator
# is "let"
s.arguments := a # assign "a" to the "arguments" field
... # etc.
}
"syntax_tree::apply": { # etc.
s.arguments := a
...
}
(The "::" is an arbitrary separator). This permanently assigns to the
arguments field of "s" -- if that's not okay it could be made
"temporary" by working on a copy of s.
Am I still missing the point?
-- Bob Alexander
Metaphor Computer Systems (415) 966-0751 alex@metaphor.com
====^=== Mountain View, CA ...{uunet}!{decwrl,apple}!metaphor!alex